<!---
Copyright: (c) 2006 The MachBlog Authors
Authors: Matt Woodward (mpwoodward@gmail.com) & Peter J. Farrell (pjf@maestropublishing.com)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and 
limitations under the License.

$Id: CategoryDAO.cfc 1190 2007-07-14 17:22:31Z pfarrell $

Notes:
TODO: have read method return a category bean instead of a query
--->
<cfcomponent
	displayname="CategoryDAO"
	output="false"
	hint="Base CategoryDAO for MachBlog">

	<!---
	PROPERTIES
	--->
	<cfproperty name="datasource" type="machblog.org.machblog.datasource.Datasource" required="true" />
	<cfproperty name="resourceBundleFacade" type="machblog.org.machblog.facades.ResourceBundleFacade" required="true" />

	<!---
	INITIALIZATION / CONFIGURATION
	--->
	<cffunction name="init" access="public" output="false" returntype="CategoryDAO" 
		hint="Constructor for this CFC.">
		<cfreturn this />
	</cffunction>

	<cffunction name="setDatasource" access="public" output="false" returntype="void"
		hint="Dependency: injected">
		<cfargument name="datasource" type="machblog.org.machblog.datasource.Datasource" required="true" />
		<cfset variables.datasource = arguments.datasource />
	</cffunction>	
	<cffunction name="getDatasource" access="private" output="false" returntype="machblog.org.machblog.datasource.Datasource">
		<cfreturn variables.datasource />
	</cffunction>	

	<cffunction name="setResourceBundleFacade" access="public" output="false" returntype="void" 
		hint="Dependency: injected">
		<cfargument name="resourceBundleFacade" type="machblog.org.machblog.facades.ResourceBundleFacade" required="true" />
		<cfset variables.resourceBundleFacade = arguments.resourceBundleFacade />
	</cffunction>
	<cffunction name="getResourceBundleFacade" access="private" output="false" returntype="machblog.org.machblog.facades.ResourceBundleFacade">
		<cfreturn variables.resourceBundleFacade />
	</cffunction>

	<!---
	PUBLIC FUNCTIONS - CRUD
	--->
	<cffunction name="create" access="public" output="false" returntype="void" hint="Creates a new category">
		<cfargument name="category" type="Category" required="true" />
	</cffunction>
	
	<cffunction name="read" access="public" output="false" returntype="query"
		hint="Populates a Category bean">
		<cfargument name="categoryId" type="string" required="true" />
	</cffunction>
	
	<cffunction name="update" access="public" output="false" returntype="void" 
		hint="Updates a category.">
		<cfargument name="category" type="Category" required="true" />
	</cffunction>
	
	<cffunction name="delete" access="public" output="false" returntype="void" 
		hint="Deletes a category.">
		<cfargument name="category" type="Category" required="true" />
	</cffunction>
	
</cfcomponent>